package com.gsit.misn.common;

public enum Gender {

	MALE("Male"), SINGLE("Single"),
	NAN("");

	private String code;

	private static Gender[] values = Gender.values();

	private Gender(String code) {
		this.code = code;
	}

	public String toCode() {
		return code;
	}

	public static Gender fromCode(String code) {
		for (Gender status : values) {
			if (status.code.equalsIgnoreCase(code))
				return status;
		}

		return NAN;
	}

	@Override
	public String toString() {
		return new StringBuilder(super.toString()).append(",code[")
				.append(code).append("]").toString();
	}

}
